<!-- index.html -->

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta charset="UTF-8">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" />
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css">
</head>
<body>
  <div id="app"></div>
  <script>

    const sleep = ms => new Promise(r => setTimeout(r, ms));
    //     意义不明
    window.$docsify = {
      repo: 'Wsine/blog',
      loadSidebar: true,
      subMaxLevel: 2,
    //  如果子目录有_sidebar.md，但你就想使用根目录的_sidebar.md，
    // 可在index.html文件中的window.$docsify添加alias细分：
      alias: {
        '/.*/_sidebar.md': '/_sidebar.md'
      },
      auto2top: true,
      name: 'Wsine Blog',
      loadNavbar: true,
       
       // 封面支持，启用封面页，默认加载的是项目根目录下的_coverpage.md文件
      markdown: {
        renderer: {
          // 把把markdown语法变成js可识别的形式
          code: function(code, lang) {
            if (lang === "flow") {
              (async () => {
                await sleep(500);
                var diagram = flowchart.parse(code);
                diagram.drawSVG('flow');
              })();
              return '<div id="flow"></div>';
            } else if (lang === "sequence") {
              (async () => {
                await sleep(500);
                var diagram = Diagram.parse(code);
                diagram.drawSVG('sequence', {theme: 'simple'});
              })();
              return '<div id="sequence"></div>';
            } else if (lang === "mermaid") {
              return (
                '<div class="mermaid">' + mermaid.render(lang, code) + "</div>"
              );
            } else if (lang === "c++") {
              lang = "cpp";
            }
            return this.origin.code.apply(this, arguments);
          }
        }
      },
      plugins: [
        //不懂哦
        function(hook, vm) {
          hook.doneEach(function() {
            document.querySelectorAll(".sidebar-nav > ul > li").forEach(
              function(node, index, nodelist) {
                var span = document.createElement("span");
                span.innerHTML = node.firstChild.data;
                span.style.cursor = "pointer";
                span.onclick = function(event) {
                  var ul = event.target.nextElementSibling;
                  if (ul.style.display === "none") {
                    ul.style.display = "block";
                  } else {
                    ul.style.display = "none";
                  }
                };
                node.firstChild.replaceWith(span);
                node.lastChild.style.display = "none";
            });
            var active = document.querySelector(".sidebar-nav li.active");
            if (active) {
              active.parentElement.style.display = "block";
            }
          });
        }
      ]
    }
  </script>
  <!-- docsify -->
  <script src="//unpkg.com/docsify"></script>
  <!--<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>-->
  <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
  <!-- additional language highlight -->
  <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-python.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-cmake.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-java.min.js"></script>
  <!-- flowchart requirements -->
  <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.2.0/raphael-min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/flowchart/1.12.0/flowchart.min.js"></script>
  <!-- sequence diagram requirments -->
  <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/js-sequence-diagrams/1.0.6/sequence-diagram-min.js"></script>
  <!-- mermaid erquirements -->
  <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
  <script type="text/javascript">mermaid.initialize({ startOnLoad: false });</script>
  <!-- 搜索功能支持 -->
  <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
     <!-- latex支持 -->
    <!-- CDN files for docsify-katex -->
    <script src="//cdn.jsdelivr.net/npm/docsify-katex@latest/dist/docsify-katex.js"></script>
    <!-- or <script src="//cdn.jsdelivr.net/gh/upupming/docsify-katex@latest/dist/docsify-katex.js"></script> -->
    <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"/>  
        <!-- 用来实现页尾的上下章节功能 -->
    <script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
  </script>
  <script>
		if (typeof navigator.serviceWorker !== 'undefined') {
			navigator.serviceWorker.register('sw.js')
		}
	</script>
</body>
</html>
